<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/share/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
    <title>新增管理</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<%@ include file="/WEB-INF/share/easyuilist.jsp"%>
    <script type="text/javascript">
	    var keyValue = request('id');
	    var parentId = request('pid');
	    $(function () {
	    	initControl();
	    	var target = '${target}';
	    	if(target)$('#target').ComboBoxSetValue(target);
	    	if(parentId)
	            $("#pid").ComboBoxTreeSetValue(parentId);
	    })
	    //初始化控件
	    function initControl() {
	        //目标
	        $("#target").ComboBox({
	            description: "==请选择==",
	            height: "200px",
	            isuse:true
	        });
	        //上级
	        $("#pid").ComboBoxTree({
	            url: "${ctx}/fun/GetTreeJson",
	            description: "==请选择==",
	            height: "195px"
	        });
	        
	        $("#btn_finish").click(function () {
	            AcceptClick();
	        })
	    }
	    //选取图标
	    function SelectIcon() {
	        dialogOpen({
	            id: "SelectIcon",
	            title: '选取图标',
	            url: '/fun/icon?ControlId=iconCls',
	            width: "1000px",
	            height: "600px",
	            btn: false
	        })
	    }
	    //保存表单
	    function AcceptClick() {
	        if (!$('#form1').Validform()) {
	            return false;
	        }
	        var postData = $("#form1").GetWebControls(keyValue);
	        if (postData["pid"] == "") {
	            postData["pid"] = '';
	        }
	        $.SaveForm({
	            url: "${ctx}/fun/save",
	            param: postData,
	            loading: "正在保存数据...",
	            success: function () {
	                $.currentIframe().$("#gridTable").trigger("reloadGrid");
	            }
	        })
	    }
	</script>
</head>
<body>
<form id="form1">
	<div class="widget-body">
	        <input id="id" type="hidden" value="${id}" />
	            <table class="form">
	                <tr>
	                    <th class="formTitle">名称<font face="宋体">*</font></th>
	                    <td class="formValue">
	                        <input id="title" value="${title}" type="text" class="form-control" placeholder="请输入名称" isvalid="yes" checkexpession="NotNull" />
	                    </td>
	                </tr>
	                <tr>
	                    <th class="formTitle">上级</th>
	                    <td class="formValue">
	                        <div id="pid" value="${pid}" type="selectTree" class="ui-select">
	                        </div>
	                    </td>
	                    <th class="formTitle">图标</th>
	                    <td class="formValue">
	                        <input id="iconCls" value="${iconCls}" type="text" class="form-control" />
	                        <span class="input-button" onclick="SelectIcon()" title="选取图标">...</span>
	                    </td>
	                </tr>
	                <tr>
	                    <th class="formTitle">目标<font face="宋体">*</font></th>
	                    <td class="formValue">
	                        <div id="target" type="select" class="ui-select" isvalid="yes" checkexpession="NotNull">
	                            <ul>
	                                <li data-value="expand">expand</li>
	                                <li data-value="iframe">iframe</li>
	                                <li data-value="open">open</li>
	                                <li data-value="href">href</li>
	                                <li data-value="blank">blank</li>
	                            </ul>
	                        </div>
	                    </td>
	                    <th class="formTitle">排序<font face="宋体">*</font></th>
	                    <td class="formValue">
	                        <input id="sort" value="${sort}" type="text" class="form-control" isvalid="yes" checkexpession="Num" />
	                    </td>
	                </tr>
	                <tr>
	                    <th class="formTitle">地址</th>
	                    <td class="formValue" colspan="3">
	                        <input id="linkurl" value="${linkurl}" type="text" class="form-control" />
	                    </td>
	                </tr>
	            </table>
	        </div>
	<div class="form-button" id="wizard-actions">
	    <a id="btn_finish" class="btn btn-success">完成</a>
	</div>
</form>
</body>
</html>
